package tinybase.basic;

import tinybase.pf.Statistic;

public enum RC {
/**
 * PF Return Code
 */
	STAT_INVALID_ARGS(Statistic.STAT_BASE + 1), STAT_KNOWN_KEY(
			Statistic.STAT_BASE + 2), PF_SUCCESS(0), // 
	PF_PAGEPINNED(RedBase.START_PF_WARN + 0), // page pinned in buffer
	PF_PAGENOTINBUF(RedBase.START_PF_WARN + 1), // page to be unpinned is not in
												// buffer
	PF_INVALIDPAGE(RedBase.START_PF_WARN + 2), // invalid page number
	PF_FILEOPEN(RedBase.START_PF_WARN + 3), // file handle already open
	PF_CLOSEDFILE(RedBase.START_PF_WARN + 4), // file is closed
	PF_PAGEFREE(RedBase.START_PF_WARN + 5), // page already free
	PF_PAGEUNPINNED(RedBase.START_PF_WARN + 6), // page already unpinned
	PF_EOF(RedBase.START_PF_WARN + 7), // end of file
	PF_TOOSMALL(RedBase.START_PF_WARN + 8), PF_LASTWARN(PF_TOOSMALL),

	PF_NOMEM(RedBase.START_PF_ERR - 0), // out of memory
	PF_NOBUF(RedBase.START_PF_ERR - 1), // out of buffer space
	PF_INCOMPLETEREAD(RedBase.START_PF_ERR - 2), // incomplete read of page from
													// file
	PF_INCOMPLETEWRITE(RedBase.START_PF_ERR - 3), // incomplete write of page to
													// file
	PF_HDRREAD(RedBase.START_PF_ERR - 4), // incomplete read of header from file
	PF_HDRWRITE(RedBase.START_PF_ERR - 5), // incomplete write of header to file
	
	// Internal PF errors:

	PF_PAGEINBUF(RedBase.START_PF_ERR - 6), // new allocated page already in
											// buffer
	PF_HASHNOTFOUND(RedBase.START_PF_ERR - 7), // hash table entry not found
	PF_HASHPAGEEXIST(RedBase.START_PF_ERR - 8), // page already exists in hash
												// table
	PF_INVALIDNAME(RedBase.START_PF_ERR - 9), // invalid file name

	PF_UNIX(RedBase.START_PF_ERR - 10), // Unix error
	PF_LASTERR(PF_UNIX),
	
	PF_FILEEXIST, 
    PF_CANNOTCREATEFILE, 
    PF_FILENOTFOUND, 
    PF_FAILEDTODELETEFILE,

    /**
     * RM Return Code	
     */
    
    RM_SUCCESS(PF_SUCCESS),
    RM_INVIABLERID(RedBase.START_RM_WARN + 0),
    RM_UNREADRECORD(RedBase.START_RM_WARN + 1), // unread record
    RM_INVALIDRECSIZE(RedBase.START_RM_WARN + 2), // invalid record size
    RM_INVALIDSLOTNUM(RedBase.START_RM_WARN + 3), // invalid slot number
    RM_RECORDNOTFOUND(RedBase.START_RM_WARN + 4), // record not found
    RM_INVALIDCOMPOP(RedBase.START_RM_WARN + 5), // invalid comparison operator
    RM_INVALIDATTR(RedBase.START_RM_WARN + 6), // invalid attribute parameters
    RM_NULLPOINTER(RedBase.START_RM_WARN + 7), // pointer is null
    RM_SCANOPEN(RedBase.START_RM_WARN + 8), // scan is open
    RM_CLOSEDSCAN(RedBase.START_RM_WARN + 9), // scan is closed
    RM_CLOSEDFILE(RedBase.START_RM_WARN + 10);// file handle is closed

	private Integer value;

	private RC(int value) {
		this.value = value;
	}

	private RC() {

	}

	private RC(RC rc) {
		this.value = rc.value;
	}

	public Integer getValue() {
		return this.value;
	}
}
